﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using Microsoft.WindowsAzure.Storage.Table; 

namespace MovieReview.Models
{
    
        // a listing for a Movie
        public class MovieListing : TableEntity 
        {
            public MovieListing()
            {
            }

            // Movie name
            [Required(ErrorMessage = "Invalid Movie Name")]    // data validation
            public string MovieName
            {
                get
                {
                    return PartitionKey;
                }
                set
                {
                    PartitionKey = value;
                }
            }

            // User or reviewer name
            [MaxLength(50, ErrorMessage = "Name is too long")] // data validation
            public string Reviewer
            {
                get
                {
                    return RowKey;
                }
                set
                {
                    RowKey = value;
                }
            }

            // Movies rating
            [Range(0.00001, 9.99999)] // data validation
            public double Rating
            {
                get;
                set;
            }

            // Movies release date
            public DateTime ReleaseDate
            {
                get;
                set;
            }

            // Movies review
            [MaxLength(140, ErrorMessage = "Review too long")]
            public string Review
            {
                get;
                set;
            }
        }
}
